package com.example.rbacmanage.service.app.impl;

import com.example.rbacmanage.entity.app.FriendshipLink;
import com.example.rbacmanage.mapper.app.FriendshipLinkMapper;
import com.example.rbacmanage.service.app.FriendshipLinkService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FriendshipLinkServiceImpl implements FriendshipLinkService {
    @Autowired
    private FriendshipLinkMapper friendshipLinkMapper;

    @Override
    public void save(FriendshipLink friendshipLink) {
        friendshipLinkMapper.insert(friendshipLink);
    }

    @Override
    public void remove(Long[] ids) {
        for (Long id : ids) {
            friendshipLinkMapper.del(id);
        }
    }

    @Override
    public void update(FriendshipLink friendshipLink) {
        friendshipLinkMapper.update(friendshipLink);
    }

    @Override
    public List<FriendshipLink> getAll(FriendshipLink friendshipLink) {
        return friendshipLinkMapper.list(friendshipLink);
    }

    @Override
    public PageInfo<FriendshipLink> getPage(FriendshipLink friendshipLink) {
        return new PageInfo<>(getAll(friendshipLink));
    }

    @Override
    public FriendshipLink getById(Long id) {
        return friendshipLinkMapper.queryOneById(id);
    }

    @Override
    public Integer getCount(FriendshipLink friendshipLink) {
        return friendshipLinkMapper.count(friendshipLink);
    }
}
